GBML manual / Events

step

Runs every unpaused frame, after alarms and button events, before movement (S2.10 step 4).

Syntax

step: fires every unpaused frame, after alarms and button events

Description

The ordinary per-frame event: runs every unpaused frame, after alarms and button events, before movement. This is where hsp/vsp/speed/direction normally get set, since whatever they are set to here is what step 5 of the frame (The order of a frame) actually applies - reading x/y during Step still gives this frame's starting position, because movement has not run yet.

Example

if (btn_held(BTN_RIGHT)) {
    hsp = 2;
} else if (btn_held(BTN_LEFT)) {
    hsp = -2;
} else {
    hsp = 0;
}

Sets this frame's horizontal speed from the d-pad; the engine's own movement step applies it afterward.

See also: step_beginstep_endThe order of a frameEvents